package org.hy.pay.message.model;


/**
 * $.ajax后需要接受的JSON
 * 
 * @author lzm
 * 
 */
public class AjaxJson {
    //请求结果代码
	private int code ;
	
	//请求结果消息
	private String msg;
	
	//返回对象列表
	private Object data;

	
	public AjaxJson() {
		this.code = 0;
		this.msg = "success";
	}
	
	public AjaxJson(String msg){
		this.msg = msg;
	}
	
	public static AjaxJson error() {
		return error(500, "未知异常，请联系管理员");
	}
	
	public static AjaxJson error(String msg) {
		return error(500, msg);
	}
	
	public static AjaxJson error(int code, String msg) {
		AjaxJson r = new AjaxJson();
		r.code = code;
		r.msg = msg;
		return r;
	}

	public static AjaxJson ok(Object data) {
		AjaxJson r = new AjaxJson();
		r.data = data;
		return r;
	}
	
	public static AjaxJson ok() {
		return new AjaxJson();
	}

	public int getCode() {
		return this.code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return this.msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getData() {
		return this.data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	
	
  
		
    
}
